import 'package:flutter/material.dart';

class ImageLabel extends StatelessWidget {
  ImageLabel({
    Key key,
    this.width,
    @required this.height,
    @required this.text,
    @required this.image,
    @required this.onPressed,
    this.color,
  }) : super(key: key);

  final double width;
  final double height;
  final Widget text;
  final Image image;
  final VoidCallback onPressed;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Ink(
      decoration: BoxDecoration(color: this.color),
      child: InkWell(
        borderRadius: BorderRadius.all(Radius.circular(height / 2)),
        onTap: onPressed,
        child: SizedBox(
          width: this.width ?? this.height,
          height: this.height,
          child: Column(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Flexible(
                flex: 2,
                child: image,
              ),
              SizedBox(height: 4,),
              Flexible(
                flex: 1,
                child: Center(
                  child: text,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
